/******************************************************************************
 * Title:     Younker Web Appliaction Framework
 * Copyright: Copyright (c) 2004
 * Company:   YounkerSoft
 * Author:        Xiao Jian
 * Version:   2.0
 *****************************************************************************/
package com.younker.waf.component.dbgrid;

import java.io.Serializable;
import java.util.*;

/**
 * DBGrids.java
 */
public class DBGrids implements Serializable
{

        /**
         * 
         */
        private static final long serialVersionUID = 20574212171955703L;
        private Map<String, DBGrid> dbGrids;

        public DBGrids()
        {
                dbGrids = new HashMap<String, DBGrid>();
        }

        public void addDBGrid(DBGrid dbgrid)
        {
                String gridName = dbgrid.getGridName();
                if (dbGrids.containsKey(gridName))
                        return;
                else
                        dbGrids.put(gridName, dbgrid);
        }

        public DBGrid getDBGrid(Object gridName)
        {
                if (dbGrids.containsKey(gridName))
                        return (DBGrid) dbGrids.get(gridName);
                else
                        return null;
        }

        public String toString()
        {
                StringBuffer sb = new StringBuffer();
                Object[] s = dbGrids.values().toArray();
                for (int i = 0; i < s.length; i++)
                {
                        sb.append(s[i]);
                }
                return sb.toString();
        }
}
